<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCultureVoiceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('culture_voice', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('自增ID');

            $table->string('title', 300)->comment('标题');
            $table->string('content', 2000)->comment('内容');
            $table->string('url', 500)->comment('作品url');
            $table->unsignedBigInteger('publisher_uid')->comment('发布者uid')->index();

            $table->unsignedTinyInteger('type')->default(1)->comment('类型 1、视频 2、音频');
            $table->unsignedInteger('duration')->comment('时长(秒)');
            $table->string('cover', 500)->comment('作品封面图');

            $table->timestamps();
            $table->softDeletes();

            $table->engine = 'InnoDB';

        });
        DB::statement("alter table `culture_voice` comment'文化之声作品表'");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('culture_voice');
    }
}
